 <meta charset="utf-8">

 <div class="box" id="biz_percentage_conatainer">
            <div class="box-header with-border">
               <form id="searchForm" role="form" method="post" class="form-inline">
                   <div class="form-group" v-if="role=='ADMIN'">
	                  <label for="practitionerName">执业人员姓名</label>
	                  <input type="text"  style="width: 120px;" readonly="readonly" v-on:click="choosePractitioner" v-model="searchForm.practitionerName"  name="practitionerName" class="form-control" id="practitionerName" placeholder="点击选择" required>
	                </div> 
	                <div class="form-group">
	                  <label for="zhiPaiRenYuanNme">指派人员姓名</label>
	                  <input type="text"  style="width: 120px;"  readonly="readonly" v-on:click="chooseZhiPaiRenYuan" v-model="searchForm.zhiPaiRenYuanNme"  name="zhiPaiRenYuanNme" class="form-control" id="zhiPaiRenYuanNme" placeholder="点击选择" required>
	                </div> 
                    <div class="form-group">
                         <label>委托人</label>
                         <input name="weiTuoRenName" style="width: 160px;"  v-model="searchForm.weiTuoRenName"   type="text" placeholder="" class="form-control">
                    </div>
                    
                      <div class="form-group">
                         <label>案号</label>
                         <input name="name" style="width: 165px;"  v-model="searchForm.caseNum"   type="text" placeholder="" class="form-control">
                    </div>
                    
                      <div class="form-group">
                         <label>案由</label>
                         <input name="caseReason" style="width: 165px;"  v-model="searchForm.caseReason"   type="text" placeholder="" class="form-control">
                    </div>
                    
                    	<br>
                     <div class="form-group">
		                <label for="startTime">开始时间&nbsp;&nbsp;</label>
		                 <input type="text" style="width: 100px;"   v-kmdate="{vmodel:'searchForm.startTime',format:'yyyy-MM-dd'}"  class="form-control"  v-model="searchForm.startTime">
		            </div>
	             <div class="form-group">
	                <label for="enfTime">截止时间&nbsp;&nbsp;</label>
	                 <input type="text" style="width: 100px;"   v-kmdate="{vmodel:'searchForm.endTime',format:'yyyy-MM-dd'}"  class="form-control"  v-model="searchForm.endTime">
	            </div>
	            
	               <div class="form-group">
		                  <label for="caseLiAnStatus" >收案结清</label>
		                  <select style="width: 100px;"  id="caseLiAnStatus" v-model="searchForm.caseLiAnStatus"  name="caseLiAnStatus"  class="form-control" >
		                   <option value="">不限制</option>
		                    <option value="1">未结清</option>
		                    <option value="2">已结清</option>
		                  </select>
		                </div>
		                
		            <div class="form-group">
		                  <label for="caseJieAnStatus" >结案结清</label>
		                  <select style="width: 100px;"  id="caseJieAnStatus" v-model="searchForm.caseJieAnStatus" name="caseJieAnStatus"  class="form-control"  >
		                    <option value="">不限制</option>
		                    <option value="1">未结清</option>
		                    <option value="2">已结清</option>
		                  </select>
		                </div>
		                
		                 <div class="form-group">
		                  <label for="caseTuiFeiStatus" >退费状态</label>
		                  <select style="width: 100px;"  id="caseStatusJieAn" v-model="searchForm.caseTuiFeiStatus" name="caseTuiFeiStatus"  class="form-control" >
		                    <option value="">不限制</option>
		                    <option value="1">未结清</option>
		                    <option value="2">已结清</option>
		                  </select>
		                </div>
	                <button type="button"  class="btn btn-info pull-right m-t-n-xs"  v-on:click="doExportx"><strong>导出</strong></button> 
                    <button type="button"  class="btn btn-info pull-right m-t-n-xs"  v-on:click="search"><strong>查询</strong></button>
            
                </form>
            </div>
 <div class="box-body">
 	                           <div class="btn-group " id="percentageBTableToolbar" role="group">
 	                           		<button type="button" v-kperms="{perm:'authRole:addRole'}"  class="btn btn-default" v-on:click="add">
                                        <i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加
                                    </button>
                                     <button type="button"  class="btn btn-default" v-on:click="edit">
                                        <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改
                                    </button>
                                   
                                    
                                   
                                    </button>
                                       <button type="button"  v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCaseStatus('jieAn',2)">
                                        <i class="glyphicon glyphicon-download" aria-hidden="true"></i> 结案结清
                                    </button>
                                     <button type="button"  v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCaseStatus('jieAn',1)">
                                        <i class="glyphicon glyphicon-refresh" aria-hidden="true"></i> 撤销结案
                                    </button>
                              
                                     <button type="button" v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCaseStatus('tuiFei',2)">
                                        <i class="glyphicon glyphicon-save" aria-hidden="true"></i> 退费结清
                                    </button>
                                     <button type="button"  v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCaseStatus('tuiFei',1)">
                                        <i class="glyphicon glyphicon-refresh" aria-hidden="true"></i> 撤销退费
                                    </button>
                                     <button type="button"  v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCaseStatus('tuiFei',3)">
                                        <i class="glyphicon glyphicon-remove" aria-hidden="true"></i> 终止委托
                                    </button>
                                    
                                     </button>
                                       <button type="button" v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCheckStatus('shenHe',2)">
                                        <i class="glyphicon glyphicon-download-alt" aria-hidden="true"></i> 审核
                                    </button>
                                    
                                      </button>
                                       <button type="button" v-if="role=='ADMIN'" class="btn btn-default" v-on:click="setCheckStatus('shenHe',1)">
                                        <i class="glyphicon glyphicon-refresh" aria-hidden="true"></i> 撤销审核
                                    </button>
                                    
                                    <button type="button"  v-if="role=='ADMIN'" class="btn btn-default" v-on:click="deletex">
                                        <i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除
                                    </button>
                                    
                                    
                                   <!--  <span >&nbsp;</span>
                                    <span ref=>统计：{{totoleCount}}</span> -->
                           </div>
                                
          	 <table id="percentageBTable" data-mobile-responsive="true" style="table-layout:fixed ;"   ></table>
 </div>
 </div>
<script> 
new Vue({  
	  el: '#biz_percentage_conatainer',  
	  data:{
		  searchForm:{
			practitionerName: null,
			practitionerId: null,
      		zhiPaiRenYuanId: null,
      		zhiPaiRenYuanNme: null,
      		caseNum: null,
      		weiTuoRenName: null,
      		startTime: null,
      		endTime: null,
      		caseLiAnStatus: null,
      		caseJieAnStatus: null,
      		caseTuiFeiStatus: null,
      		caseReason: null,
		  },
		  role: null,
		  bus:new Vue(),
	  },
	  mounted:function(){
		 let _this=this;
		 _this.initToolBar();
		 _this.initTable();
	  },
  methods: {
	  initToolBar: function(){
		  var _this=this;
		  var ajaxUrl="/auth/getUserInfo";
		  zfesAjax.ajaxTodo(ajaxUrl, {}, function(data) {
				_this.role=data.data.sessionUser.role;
			}); 
	  },
	  initTable:function(){
		  let _this=this;
		  let columns=[
				{checkbox:true},
				{field:'caseNum',title:'案号',width:100},
				{field:'checkStatus',title:'审核状态',width:80,formatter:function(value,row,index){
					if("1"==value||1==value){return '<span class="label label-danger">未审核</span>';
					}else if("2"==value||2==value){return '<span class="label label-success">已审核</span>';}}},
				{field:'practitionerName',title:'执业人员',width:100,sortable:true,formatter:function(value,row,index){
					if('-'==value){return '<span class="label label-danger">总计</span>';}else{return value;}
				}},
				{field:'cooperPractitionerName',title:'合办律师',width:100},
				{field:'zhiPaiPractitionerName',title:'指派人员',width:100},
				
				
				{field:'recaordTime',title:'记录时间',width:100,sortable:true},
				{field:'jieAnTime',title:'结案时间',width:100,sortable:true},
				{field:'heTongTime',title:'受理时间',width:100,sortable:true},
				/* {field:'caseProgress',title:'案件进展',width:80,formatter:function(value,row,index){
					if("1"==value||1==value){
						return '<span class="label label-success">立案</span>';
					}else if("2"==value||2==value){
						return '<span class="label label-danger">结案</span>';}}
				}, */
				{field:'caseReason',title:'案由',width:300},
				{field:'caseFileNum',title:'案卷号',width:100},
				{field:'caseAgreementNum',title:'合同号',width:100},
				
				{field:'caseLiAnStatus',title:'收案结算',width:100,formatter:function(value,row,index){
					if("1"==value||1==value){return '<span class="label label-danger">未结清</span>';
					}else if("2"==value||2==value){return '<span class="label label-success">已结清</span>';}}
				},
				{field:'caseJieAnStatus',title:'结案结算',width:100,formatter:function(value,row,index){
					if("1"==value||1==value){return '<span class="label label-danger">未结清</span>';
					}else if("2"==value||2==value){return '<span class="label label-success">已结清</span>';}}
				},
				{field:'caseTuiFeiStatus',title:'退费状态',width:100,formatter:function(value,row,index){
					if("1"==value||1==value){return '<span class="label label-danger">未结清</span>';
					}else if("2"==value||2==value){return '<span class="label label-success">已结清</span>';
					}else if("3"==value||3==value){return '<span class="label label-danger">终止委托</span>';
					}}
				},
				
				{field:'weiTuoRenName',title:'委托人姓名',width:100,formatter:_this.formatLen},
				{field:'weiTuoRenPhone',title:'委托人电话',width:90},
				
				{field:'duiFangDangShiRenName',title:'对方当事人姓名',width:120,formatter:_this.formatLen},
				{field:'duiFangDangShiRenPhone',title:'对方当事人电话',width:120},
				
				{field:'diSanRenName',title:'第三人姓名',width:120,formatter:_this.formatLen},
				{field:'diSanRenPhone',title:'第三人电话',width:120},
				
				
				
				{field:'feeYingShowDailiFei',title:'应收代理费',width:100,formatter:_this.formatx},
				{field:'feeShiShowDaiLiFei',title:'实收代理费',width:100,formatter:_this.formatx},
				{field:'feeShiQianDaiLiFei',title:'实欠代理费',width:100,formatter:_this.formatx},
				{field:'tiChengBiLi',title:'提成比例',width:100},
				{field:'feeTiChengJinEr',title:'提成金额',width:100,formatter:_this.formatx},
				{field:'feeYiTiJinEr',title:'已提金额',width:100,formatter:_this.formatx},
				{field:'feeWeiTiJinEr',title:'未提金额',width:100,formatter:_this.formatx},
		      	
				{field:'feeGuiDangFei',title:'归档费',width:100,formatter:_this.formatx},
				{field:'feeYiTiGuiDangFei',title:'已提归档费',width:100,formatter:_this.formatx},
				{field:'feeYingKaiFaPiaoJinEr',title:'应开发票金额',width:140,formatter:_this.formatx},
				{field:'feeYiKaiFaPiaoJinEr',title:'已开发票金额',width:140,formatter:_this.formatx},
				{field:'yiKaiFaPiaoHao',title:'已开发票号',width:130},
				{field:'feeWeiKaiFaPiaoJinEr',title:'未开发票金额',width:140,formatter:_this.formatx},
				{field:'feeBaoXiaoFeiYong',title:'报销费用',width:100,formatter:_this.formatx},
				{field:'feeShiFaTiCheng',title:'实发提成',width:100,formatter:_this.formatx},
		      	
				{field:'feeTuiFeiJinEr',title:'退费金额',width:100,formatter:_this.formatx},
				{field:'feeLvShiYingFanHuanTiCheng',title:'律师应返还提成',width:140,formatter:_this.formatx},
				{field:'feeLvShiYiFanHuanTiCheng',title:'律师已返还提成',width:140,formatter:_this.formatx},
				{field:'feeLvShiWeiFanHuanTiCheng',title:'律师未返还提成',width:140,formatter:_this.formatx},
				{field:'feeYingFanFaPiaoShuiJin',title:'应返还发票税金',width:140,formatter:_this.formatx},
		      	{field:'feeYiFanFaPiaoShuiJin',title:'已返还发票税金',width:140,formatter:_this.formatx}
				];
		  var url="tcms/percentage/loadPercentageDataSet";
		  //alert(window.innerHeight-50-60-130-30);
		  var h=window.innerHeight-50-60-130-40;
  		zfesBstable.vueLoadTable($("#percentageBTable"),$("#percentageBTableToolbar"),url,columns,this.searchForm,
  				
  				{showFooter: false,height:h,
	  			rowStyle:function(row,index) {
	  	  			 if(row.id==-99){
	  	  				return { classes: 'warning' }
	  	  			 }else{
	  	  				 return {};
	  	  			 }
	  	  		},
  			responseHandler: function (res) {
	  			//let footerx=res.footer[0];
	  			//console.log(footerx);
	  			//console.log(_this.sumCount);
	  			//_this.sumCount=footerx;
	  			//console.log(_this.data.sumCount);
	  			/* let textm="【金额统计："+
	  				 "已收:"+footer.sumfeeShouKuanYiShou+" ， "
	  				+"应收:"+footer.sumfeeShouKuanYingShou+" ， "
	  				+"实欠:"+footer.sumfeeShouKuanShiQian+" ， "
	  				+"立案提成:"+footer.sumfeeTiChengLiAn+" ， <br>"
	  				+"结案提成:"+footer.sumfeeTiChengJieAn+" ， "
	  				+"交通查档保全总额:"+footer.sumfeeJiaoTongZonge+" ， "
	  				+"总额支取:"+footer.sumfeeJiaoTongZhiQu+" ，<br> "
	  				+"指派金额:"+footer.sumfeeZhiPai+" ， "
	  				+"退费金额:"+footer.sumfeeTuiFei+" ， "
	  				+"咨询费:"+footer.sumfeeZiXunFei+" ， "
	  				+"已开发票数:"+footer.sumYiKaiFaPiaoShue+"】";
	  			_this.totoleCount=textm;//JSON.stringify(textm); */
	  	         return res;
	  	    } 
	  	  
  		 });
	  },
	  formatx:function(value,row,index){
		  if(isNaN( value )){
			return value ;
		}else{
			return parseFloat(value).toFixed(2);
		}
	  },
	  formatLen: function(value,row,index){
		  if(!value){
			  return "";
		  }
		  
		 let len=value.length;
		 if(len>6){
			 return  value.substring(0,6)+"..";
		 }else{
			 return  value;
		 }
	  },
	  search:function(){
		  zfesBstable.reload($("#percentageBTable")); 
	  },
	  refresh:function(){
		  zfesBstable.refresh($("#percentageBTable"));
	  },
	  	chooseZhiPaiRenYuan: function(){
			let _this=this;
	    	let url="/view/tcms/practitioner/practitioner.lookback.html";
	    	let param={}
	    	zfesLayerEditDg.lookback(url, param, "选择指派人员", 800, function() {
	    		 let data =zfesLayerEditDg.getCallBackParam();
	    		 _this.searchForm.zhiPaiRenYuanNme=data.name;
	    		 _this.searchForm.zhiPaiRenYuanId=data.id;
	    	})
	  	  },
	  	choosePractitioner: function(){
	  		let _this=this;
	    	let url="/view/tcms/practitioner/practitioner.lookback.html";
	    	let param={}
	    	zfesLayerEditDg.lookback(url, param, "选择执业人员", 800, function() {
	    		 let data =zfesLayerEditDg.getCallBackParam();
	    		 _this.searchForm.practitionerName=data.name;
	    		 _this.searchForm.practitionerId=data.id;
	    	});
	  	  },
	  add:function(){
		  let　_this=this;
		 var url="/view/tcms/percentage/percentage.add.html";
		 zfesLayerEditDg.open(url,{},"执业人员提成信息编辑",1200,function(){_this.refresh();});
		 
	  },
	  
	  edit:function(){
		  if(zfesBstable.isOneRow($("#percentageBTable"))){
			  let　_this=this;
			  let id=zfesBstable.getRowId($("#percentageBTable"));
			  var url="/view/tcms/percentage/percentage.edit.html";
			  zfesLayerEditDg.open(url,{"id":id},"执业人员提成信息编辑",1200,function(){_this.refresh();}); 
		 }
	  },
	  deletex:function(){
			if(zfesBstable.isOneRow($("#percentageBTable"))){
				  let　_this=this;
					var id=zfesBstable.getRowId($("#percentageBTable"));
					 alertSwal.confirm("删除","是否执行该操作",function(){
						    let ajaxUrl = "tcms/percentage/deletPercentage";
							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
							}); 
				});
			}
				
	  },
	  setCaseStatus: function(type,caseStatus){
		  if(zfesBstable.isSelectedRow($("#percentageBTable"))){
			  let ids=zfesBstable.getRowIds($("#percentageBTable"));
			  let　_this=this;
				 alertSwal.confirm("启用","是否执行该操作",function(){
						    let ajaxUrl = "tcms/percentage/updateCaseStatus";
						    zfesAjax.ajaxTodo(ajaxUrl, {"type":type, "ids" : ids,"caseStatus":caseStatus}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
							});
						});
		  }
	  },
	  setCheckStatus: function(type,caseStatus){
		  if(zfesBstable.isSelectedRow($("#percentageBTable"))){
			  let ids=zfesBstable.getRowIds($("#percentageBTable"));
			  let　_this=this;
				 alertSwal.confirm("启用","是否执行该操作",function(){
						    let ajaxUrl = "tcms/percentage/updateCaseStatus";
						    zfesAjax.ajaxTodo(ajaxUrl, {"type":type, "ids" : ids,"caseStatus":caseStatus}, function(data) {
								alertSwal.successText(data.message);
								_this.refresh();
							});
						});
		  }
	  },
	  doExportx: function(){
		  var　_this=this;
		  // var url="/view/tcms/percentage/percentage.export.html";
			 // zfesLayerEditDg.open(url,_this.searchForm,"请选择要导出的数据项",900,function(){});
		  zfesAjax.ajaxDownload("tcms/percentage/doEexport",_this.searchForm);
		
	  }
 }

});
</script>


